const axios = require('axios')
const cheerio = require('cheerio')
function translate_baidu(text) {
    var data = {
        from: "en",
        to: "zh",
        q: text
    };

    var config = {
        method: 'post',
        url: 'https://aip.baidubce.com/rpc/2.0/mt/texttrans/v1?access_token=24.8c0a3bba3cfc19edf32c31d3aa15fdb1.2592000.1707327005.282335-46686141',
        data: data
    };
    var text = null
    axios(config)
        .then(function (response) {
            if (response.data && response.data.result.trans_result[0].dst) {
                text = response.data.result.trans_result[0].dst
            }
            return text
        })
        .catch(function (error) {
            console.log(error);
        });

}